<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

	<title>HDCMS建站利器 | 100%免费</title>
	<script src="http://www.hdweixin.com/public/js/jquery.min.js"></script>
    <script src="http://www.hdweixin.com/public/js/common.js"></script>
    <link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/css/common.css">
    
	<!-- bootstrap -->
	<link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/bootstrap/bootstrap.min.css" />
	
	<!-- RTL support - for demo only -->
	<script src="http://www.hdweixin.com/public/centaurus/js/demo-rtl.js"></script>
	
	<!-- libraries -->
	<link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/libs/font-awesome.css" />
	<link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/libs/nanoscroller.css" />

	<!-- global styles -->
	<link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/compiled/theme_styles.css" />

	<!-- this page specific styles -->
	<link rel="stylesheet" href="http://www.hdweixin.com/public/centaurus/css/libs/fullcalendar.css" type="text/css" />
	<link rel="stylesheet" href="http://www.hdweixin.com/public/centaurus/css/libs/fullcalendar.print.css" type="text/css" media="print" />
	<link rel="stylesheet" href="http://www.hdweixin.com/public/centaurus/css/compiled/calendar.css" type="text/css" media="screen" />
	<link rel="stylesheet" href="http://www.hdweixin.com/public/centaurus/css/libs/morris.css" type="text/css" />
	<link rel="stylesheet" href="http://www.hdweixin.com/public/centaurus/css/libs/daterangepicker.css" type="text/css" />
	<link rel="stylesheet" href="http://www.hdweixin.com/public/centaurus/css/libs/jquery-jvectormap-1.2.2.css" type="text/css" />
	
	<!-- this page specific styles -->
    <link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/libs/ns-default.css"/>
    <link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/libs/ns-style-growl.css"/>
    <link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/libs/ns-style-bar.css"/>
    <link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/libs/ns-style-attached.css"/>
    <link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/libs/ns-style-other.css"/>
    <link rel="stylesheet" type="text/css" href="http://www.hdweixin.com/public/centaurus/css/libs/ns-style-theme.css"/>

	<!--[if lt IE 9]>
		<script src="http://www.hdweixin.com/public/centaurus/js/html5shiv.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/respond.min.js"></script>
		<![endif]-->
	</head>
	<body class="theme-whbl pace-done">

<style type="text/css">
	.tabs-wrapper .nav .active{
		background: #E9E9E9;
	}
</style>
<ol class="breadcrumb">
	<li>
		<span class="glyphicon glyphicon-home"></span>
		<a href="<?php echo U('Cms/Index/welcome')?>">首页</a>
	</li>
	<li>素材管理</li>
</ol>
<div id="page-wrapper">
	<div class="row">
		<div class="col-lg-12">
			<div class="alert alert-success" style="border:solid 1px #27ae60;">
				<strong>注意!</strong>
				随意修改菜单将影响后台功能<br/>
				随意修改菜单将影响后台功能
			</div>
		</div>
	</div>

<!-- 素材管理 -->
<div class="row">
	<div class="col-lg-12">
		<div class="main-box clearfix">
			<div class="row">
				<div class="tabs-wrapper">
					<div class="form-group col-xs-12">
					<ul class="nav">
						<li style="margin-left:5px;" class="<?php if (!$w) {echo 'active';} ?>"><a href="<?php echo U('Wx/Library/index')?>">文字消息</a></li>
						<li class="<?php if ($w == 1) {echo 'active';} ?>"><a href="<?php echo U('Wx/Library/index',array('w'=>1))?>">图文消息</a></li>
						<li class="<?php if ($w == 2) {echo 'active';} ?>"><a href="<?php echo U('Wx/Library/index',array('w'=>2))?>">图片库</a></li>
					</ul>
						
					</div>
					<?php if ($w==0) { ?>
					<div class="tab-content">
						<div class="tab-pane fade active in" id="word">
							<div class="form-group col-xs-3">
								<div class="input-group ">
									<input type="text" class="form-control" id="exmaplePrependButton">
									<span class="input-group-btn">
										<button class="btn btn-primary" type="button">Go!</button>
									</span>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<div class="table-responsive">
									<table class="table table-striped table-hover">
										<thead>
											<tr>
												<th><span>文字消息(共1个)</span></th>
												<th><span></span></th>
												<th ><a href="<?php echo U('Wx/Library/create_word')?>" class="btn btn-primary">新建文字消息</a></th>
											</tr>
										</thead>
										<tbody>
										<?php foreach ($word as $k=>$v){?>
											<tr id="<?php echo $v['id']?>">
												<td><a href=""><?php echo $v['content']?></a></td>
												<td><?php echo $v['create_at']?></td>
												<td width="100">
													<div class="btn-group">
														<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
															操作 <span class="caret"></span>
														</button>
														<ul class="dropdown-menu" role="menu">
															<li>
																<a href="<?php echo U('Wx/Library/edit_word',array('id'=>$v['id']))?>">
																	<span class=" glyphicon glyphicon-edit"></span> 编辑
																</a>
															</li>
															<li>
																<a href="javascript:;" onclick="return ajax_del(<?php echo $v['id']?>);">
																	<span class="glyphicon glyphicon-trash"></span> 删除
																</a>
															</li>
														</ul>
													</div>
												</td>
											</tr>
										<?php }?>
										</tbody>
									</table>
								</div><!-- table-responsive -->
							</div><!-- form-group col-xs-12 -->
						</div><!-- tab-pane fade active in -->
					<?php } elseif($w==1) {?>
					<div class="tab-content">
						<div class="tab-pane fade active in" id="word">
							<div class="form-group col-xs-3">
								<div class="input-group ">
									<input type="text" class="form-control" id="exmaplePrependButton">
									<span class="input-group-btn">
										<button class="btn btn-primary" type="button">Go!</button>
									</span>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<div class="table-responsive">
								    <table class="table table-striped table-hover">
										<thead>
											<tr>
												<th><span>图文消息(共1个)</span></th>
												<th><span></span></th>
												<th ><a href="<?php echo U('Wx/Library/create_wordimg',array('w'=>1))?>" class="btn btn-primary">新建图文消息</a></th>
											</tr>
										</thead>
										<tbody>
											<tr>
												<td><img style="width:100px;height:100px;" src="/public/admin/button/img/32351438247164.jpg" alt=""><a href="">那些年那些事</a></td>
												<td>07月10日</td>
												<td width="100">
													<div class="btn-group">
														<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
															操作 <span class="caret"></span>
														</button>
														<ul class="dropdown-menu" role="menu">
															<li>
																<a href="/cms/menu/48/edit">
																	<span class=" glyphicon glyphicon-edit"></span> 编辑
																</a>
															</li>
															<li>
																<a href="javascript:remove(48);">
																	<span class="glyphicon glyphicon-trash"></span> 删除
																</a>
															</li>
														</ul>
													</div>
												</td>
											</tr>
										</tbody>
									</table>
								</div><!-- table-responsive -->
							</div><!-- form-group col-xs-12 -->
						</div><!-- tab-pane fade active in -->
					<?php } else {?>
					<div class="tab-content">
						<div class="tab-pane fade active in" id="word">
							<div class="form-group col-xs-3">
								<div style="line-height:36px;" class="input-group ">
									<span>未分组</span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="">重命名</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="">删除分组</a>
								</div>
							</div>
							<div class="from-group col-xs-5">
							</div>
							<div style="line-height:36px;" class="from-group col-xs-3">
								<span>大小:不超过5M,格式:bmp,png,jpeg,jpg,gif</span>
							</div>
							<div class="from-group col-xs-1">
								<form action="" method="POST" enctype="multipart/form-data">
									<a href="javascript:;" onclick="$('#hideup').click();" class=" btn btn-primary">图片上传</a>
									<input type="submit" value="保存" class="btn btn-primary">
									<input type="file" name="cover" style="display:none;" value="图片上传" id="hideup">

								</form>
							</div>
							<div class="form-group col-xs-12">
								<div class="table-responsive">
									<table class="table table-striped table-hover">
										<thead>
											<tr>
												<th>
													<div class="checkbox-nice checkbox-inline">
														<input type="checkbox" onclick="return check_all();" id="checkbox-inl-0">
														<label for="checkbox-inl-0">
															全选
														</label>
													</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
													<button class="btn btn-default">移动分组</button>&nbsp;&nbsp;&nbsp;
													<button class="btn btn-default">删除</button>
												</th>
												<th></th>
												<th ></th>
											</tr>
										</thead>
										<tbody>
											<tr>
												<td colspan="3">
										<form action="" method="post" id="form_do">
										<?php foreach ($img as $k => $v): ?>
													<div index="<?php echo $v['id']?>" class="col-lg-2 col-md-2 col-sm-2">
														<div class="main-box clearfix">
															<div class="main-box-body clearfix">
																<img style="width:100px;height:100px;" src="/public/admin/button/img/32351438247164.jpg" alt="" class="profile-img img-responsive center-block">
																<div style="white-space:nowrap;overflow:hidden;" class="profile-details">
																	<div class="checkbox-nice checkbox-inline">
																		<input type="checkbox" name="key[]" value="<?php echo $v['id']?>" id="<?php echo $v['id']?>">
																		<label for="<?php echo $v['id']?>">
																			<?php echo mb_substr($v['name'],0,8,'utf8')?>
																		</label>
																	</div>
																</div>
																<div class="profile-message-btn center-block text-center">
																	<a class="" href="" id="" data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑名称" aria-describedby="tooltip382162"><i style="font-size: 20px" class="fa fa-edit"></i></a>&nbsp;&nbsp;

																	<div class="tooltip fade bottom in" role="tooltip" id="tooltip382162" style="top: 376px; left: 186.5px; display: block;"></div>
																	<a href="" id="" data-toggle="tooltip" data-placement="top" title="" data-original-title="移动分组" aria-describedby="tooltip382162"><i style="font-size: 20px" class="fa fa-refresh"></i></a>&nbsp;&nbsp;

																	<div class="tooltip fade bottom in" role="tooltip" id="tooltip382162" style="top: 376px; left: 186.5px; display: block;"></div>
																	<a href="javascript:;" onclick="return ajax_delimg(<?php echo $v['id']?>);" id="" data-toggle="tooltip" data-placement="top" title="" data-original-title="删除" aria-describedby="tooltip382162"><i style="font-size: 20px" class="fa fa-trash-o"></i></a>

																	<div class="tooltip fade bottom in" role="tooltip" id="tooltip382162" style="top: 376px; left: 186.5px; display: block;"></div>
																</div><!-- profile-message-btn center-block text-center -->
															</div><!-- main-box-body clearfix -->
														</div><!-- main-box clearfix -->
													</div><!-- col-lg-2 col-md-3 col-sm-3 -->
										<?php endforeach ?>
										</form>
												</td>
											</tr>
										</tbody>
									</table>
								</div><!-- table-responsive -->
							</div><!-- form-group col-xs-12 -->
						</div><!-- tab-pane fade active in -->
					<?php } ?>
					</div><!-- tab-content -->
				</div><!-- tabs-wrapper -->
			</div><!-- row -->
		</div><!-- main-box clearfix -->
	</div><!-- col-lg-12 -->
</div><!-- row -->

<!-- 素材管理 -->

</div>

		<script src="http://www.hdweixin.com/public/centaurus/js/demo-skin-changer.js"></script> <!-- only for demo -->

		<script src="http://www.hdweixin.com/public/centaurus/js/jquery.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/bootstrap.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/jquery.nanoscroller.min.js"></script>

		<script src="http://www.hdweixin.com/public/centaurus/js/demo.js"></script> <!-- only for demo -->

		<!-- this page specific scripts -->
		<script src="http://www.hdweixin.com/public/centaurus/js/jquery-ui.custom.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/fullcalendar.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/jquery.slimscroll.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/raphael-min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/morris.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/moment.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/daterangepicker.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/jquery-jvectormap-1.2.2.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/jquery-jvectormap-world-merc-en.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/gdp-data.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/flot/jquery.flot.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/flot/jquery.flot.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/flot/jquery.flot.pie.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/flot/jquery.flot.stack.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/flot/jquery.flot.resize.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/flot/jquery.flot.time.min.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/flot/jquery.flot.threshold.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/jquery.countTo.js"></script>

		<!-- theme scripts -->
		<script src="http://www.hdweixin.com/public/centaurus/js/scripts.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/pace.min.js"></script>

		<!--提示窗口Start-->
		<script src="http://www.hdweixin.com/public/centaurus/js/modernizr.custom.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/classie.js"></script>
		<script src="http://www.hdweixin.com/public/centaurus/js/notificationFx.js"></script>
		<!--提示窗口End-->

		<style type="text/css">
			/*表格菜单不隐藏*/
			.table-responsive{
				overflow-x: visible;
			}
			div#page-wrapper{
				min-height: 800px;
			}
		</style>
	</body>
	</html>
<script type="text/javascript">
	//ajax删除文字素材
	function ajax_del(id)
	{
		$.ajax({
			url: '/wx/library/' + id,
			type: 'DELETE',
			dataType: 'JSON',
			success:function(data)
			{
				dialog(data.content, 'success', 1000, function () {
				    // window.location.reload(true);
				    if(data.status)
				    {
				    	$("#" + id).remove();
				    }
				});
			}
		})
	}

	//ajax删除图片素材
	function ajax_delimg(id)
	{
		$.ajax({
			url: '<?php echo U("Wx/Library/delImg")?>',
			type: 'POST',
			data:{'id':id},
			dataType: 'JSON',
			success:function(data)
			{
				dialog(data.content, 'success', 1000, function () {
				    // window.location.reload(true);
				    if(data.status)
				    {
				    	$("div[index=" + id + "]").remove();
				    	// $("#" + id).remove();
				    }
				});
			}
		})
	}

	//全选与反选
	t = 0;
    function check_all(){
        if(t == 0){
         $("#form_do input[type='checkbox']").prop('checked',true);
         t = 1;
        }else{
         $("#form_do input[type='checkbox']").prop('checked',false);
         t = 0;
        }
    }
</script>